<template>
	<view>


    <view class="c_seven">
      <view @click="contribute()">
        <image   src="/static/image/woyaotougao.png"></image>
      </view>
      <view @click="contributeList()">
        <image  src="/static/image/findyou.png"></image>
      </view>
    </view>


    <view class="uni-padding-wrap uni-common-mt">
<!--		    <button type="warn" @click="contribute()">我要投稿</button>-->
<!--			<button type="primary" @click="contributeList()">寻找另外一个你</button>-->
			<button type="primary" @click="download()">最新版卦卦邦APP下载次数：{{downCount}}</button>
		</view>
		<view style="width:100%; text-align: center;">
			<a style="text-decoration:none" href="https://beian.miit.gov.cn/#/Integrated/index">京ICP备2023036300号-1 </a>
		</view>

    <uni-drawer ref="showRight" mode="left" :width="320" :mask-click="true">
      <uni-section class="mb-10"  title="投稿须知" @click="myCopy()"></uni-section>
      <scroll-view style="height: 80%;" scroll-y="true">
        <view style="text-align: left;font-size: 36px">本人自愿投稿，投完后无法删除</view>
        <button  type="primary" @click="tongyi()">同意</button>
        <button  type="default" @click="butongyi()">不同意</button>
      </scroll-view>
    </uni-drawer>
	</view>
</template>

<script>
	import axios from "axios";

  export default {
    created() {
      // 在组件创建时加载数据
      this.getDownCount();
    },
    mounted() {
      // 在组件创建时加载数据
      this.getDownCount();
    },
    onShow() {
      this.getDownCount();
    },
		data() {
			return {
        "downCount": 0
      }
		},
		methods: {
      butongyi() {
        this.$refs.showRight.close();
      },
      tongyi() {
        this.$refs.showRight.close();
        this.$router.push({
          path: '/pages/component/contribute/contribute'
        })
      },
      getDownCount: async function(e) {
        console.log(JSON.stringify(this.form))

        const fetchData = async () => {
          try {
            // console.log("send request...2");
            const response = await axios.get('https://www.zhixiaoyixue.com:86/getDownCount');

            // console.log(response.data);
            this.downCount = response.data.res;
          } catch (error) {
            // console.error('Fetch error:', error);
          }
        };

        // console.log("send request...1");
        try {
          await fetchData();
        } catch (err) {
        }
      },
      addDown: async function(e) {
        console.log(JSON.stringify(this.form))

        const fetchData = async () => {
          try {
            // console.log("send request...2");
            const response = await axios.get('https://www.zhixiaoyixue.com:86/addDown');

            // console.log(response.data);
            this.downCount = response.data.res;
          } catch (error) {
            // console.error('Fetch error:', error);
          }
        };

        // console.log("send request...1");
        try {
          await fetchData();
        } catch (err) {
        }
      },
			contribute() {
          this.$refs.showRight.open();
		    },
			contributeList() {
				this.$router.push({
				path: '/pages/component/contributeList/contributeList'
				})
		    },
			download(){
        this.addDown();
        // window.location.href="http://apk.zhixiaoguoxue.com/20241217/f9e76f7316f74c85b01179801f5c96bc.apk";
        window.location.href="https://www.pgyer.com/QrttupB4";
			}
		}
	}
</script>

<style>
    button {
        margin-top: 30rpx;
        margin-bottom: 30rpx;
    }

    .button-sp-area {
        margin: 0 auto;
        width: 60%;
    }

    .mini-btn {
        margin-right: 10rpx;
    }

    .content {
      padding: 24rpx;
      position: relative;
      z-index: 9;
      margin-top: -500rpx;
    }

    .c_seven {
      margin-top: 30rpx;
      display: flex;
      align-items: center;
      justify-content: space-between;

      >view {
        >image {
          width: 345rpx;
          height: 190rpx;
        }
      }
    }
</style>
